<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="btn1">click</button>
    <button class="btn2" onclick="aaa()">click</button>

    <script>
        var btn = document.querySelector('.btn1');

        // btn.onclick = function() {
        //     console.log('btn1被点击了');
        // }

        // btn.onclick = function() {
        //     console.log('btn1真的被点击了');
        // }

        // 同一个事件可以班绑定多次
        btn.addEventListener('click', function () {
            console.log('addEventListener-btn1被点击了');
        }, false)

        btn.addEventListener('click', function () {
            console.log('addEventListener-btn1真的被点击了');
        }, false)

        function aaa () {
            console.log('我是一个函数');
        }
    </script>
</body>

</html>